package com.jsp.util;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public class MD5Utils {

    public static String getEncode(String source,String salt){
        try {
            MessageDigest md5 = MessageDigest
                    .getInstance("MD5");
            String s = new String(md5.digest((source+salt).getBytes()));
            return s;
        } catch (NoSuchAlgorithmException e) {
            throw new RuntimeException("加密错误");
        }
    }

    public static void main(String[] args) {
        System.out.println(getEncode("admin", "admin"));
    }
}
